<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('好奇币记录列表')" />
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户：</label>
                                <select name="memberId" class="form-control m-b">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${memberList}" th:text="${dict.username}+'-'+${dict.frameNo}" th:value="${dict.id}"></option>
                                </select>
                            </li>
                            <li>
                                <label>类型：</label>
                                <select name="type"  th:with="type=${@dict.getType('coin_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>创建时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="btime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="etime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:coinrecord:add">-->
                    <!--<i class="fa fa-plus"></i> 添加-->
                <!--</a>-->
                <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:coinrecord:edit">-->
                    <!--<i class="fa fa-edit"></i> 修改-->
                <!--</a>-->
                <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:coinrecord:remove">-->
                    <!--<i class="fa fa-remove"></i> 删除-->
                <!--</a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:coinrecord:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js"/>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:coinrecord:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:coinrecord:remove')}]];
        var prefix = ctx + "system/coinrecord";
        var statusDatas = [[${@dict.getType('haoqiStatus')}]];
        var typeDatas = [[${@dict.getType('coin_type')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "智通币记录",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id', 
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'username',
                    title: '用户名称'
                },
                    {
                        field: 'dealer',
                        title: '门店',
                        formatter: function (value,row,index) {
                            if(value==null){
                                return "-";
                            }else{
                                return value.name;
                            }
                        }
                    },
                    {
                        field: 'memberCar',
                        title: '姓名',
                        formatter: function (value,row,index) {
                            if(value==null){
                                return "-";
                            }else{
                                return value.name;
                            }
                        }
                    },
                    {
                        field: 'memberCar',
                        title: '电话',
                        formatter: function (value,row,index) {
                            if(value==null){
                                return "-";
                            }else{
                                return value.mobile;
                            }
                        }
                    },
                    {
                        field: 'memberCar',
                        title: '车牌号',
                        formatter: function (value,row,index) {
                            if(value==null){
                                return "未绑定";
                            }else{
                                return value.licensePlate;
                            }
                        }
                    },
                    {
                        field: 'memberCar',
                        title: '车架号',
                        formatter: function (value,row,index) {
                            if(value==null){
                                return "未绑定";
                            }else{
                                return value.frameNo;
                            }
                        }
                    },
                {
                    field: 'type',
                    title: '收入',
                    formatter: function(value, row, index) {
                        if(value==0){
                            return row.num;
                        }
                        return "";
                    }
                },
                {
                    field: 'type',
                    title: '支出',
                    formatter: function(value, row, index) {
                        if(value==1){
                            return row.num;
                         }
                         return "";
                        }
                },
                // {
                //     field: 'status',
                //     title: '状态',
                //     formatter: function(value, row, index) {
                //         return $.table.selectDictLabel(statusDatas, value);
                //     }
                // },
                {
                    field: 'type',
                    title: '类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(typeDatas, value);
                    }
                },
                    {
                        field: 'getTypeName',
                        title: '科目'
                    },
                    {
                        field: 'created',
                        title: '创建时间'
                    }
                ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>